package com.sxj.corejava.code07_面向对象;

/**
 * @author 石小俊
 * @date 2025年01月06日
 */
public class Test05_方法重载 {

    public static void main(String[] args) {
        Calculator calculator = new Calculator();
        System.out.println(calculator.sum(1, 2));
        System.out.println(calculator.sum(1, 2, 3));
        System.out.println(calculator.sum(1.2, 2));
        System.out.println(calculator.sum(1.2, 2.1));
        System.out.println(calculator.sum(1, 2.1));
    }

}

class Calculator {
    public int sum(int i, int j) {
        return i + j;
    }

    public int sum(int i, int j, int k) {
        return i + j + k;
    }

    public double sum(double i, double j) {
        return i + j;
    }

    public double sum(int i, double j) {
        return i + j;
    }

    public double sum(double i, int j) {
        return i + j;
    }

    public void test() {
        System.out.println("test");
    }

    public void test(int i) {
        System.out.println("Calculator.test");
    }
}
